<?php
/**
 *  List of current not sent expenses
 * 
 * @author Xavier VILAIN
 */

use Fox\Generator;
use Fox\Html\Text;
use Fox\Html\Button;
use Fox\Html\Wrapper;
use Fox\Dao\SqlFragment;
use Hive\Expense;

$wrapper = new Wrapper('wToSend');
$wrapper->add(new Button('add','?mod=expenses&act=create',Msg(Expense::MSGCL,13)))->width("150px");
$finder = new Expense();
$expenses = $finder->find(new SqlFragment("idusr = ? AND status = ? ",
							array(User::current()->getId(),
								  Expense::STATUS_NEW)));
$wrapper->add(new Text('title-w-line',Msg(Expense::MSGCL,12)));
$grid = Xview::instance()->component("expenses","grid");
/* @var $grid Fox\Grid */

$grid->setDatas($expenses);
//
$grid->setTotal();
$grid->footer()->add(new Button('send','',Msg(Expense::MSGCL,14)));
$grid->footer()->add(new Button('delete',''));
$wrapper->add($grid);
return $wrapper;